const btButton = {
  template: `
    <button
      @click="handlerClick"
      class="btn"
      :class="[
        'btn-' + type,
        size ? 'btn-' + size : '',
        {
          'btn-block': block
        }
      ]"
      :disabled= "disabled || loading"
    >
      <i v-if="loading">加载中</i>
      <slot></slot>
    </button>
  `,
  props: {
    type: {
      type: String,
      default: 'default'
    },
    disabled: Boolean,
    size: String,
    block: Boolean,
    loading: Boolean
  },
  methods: {
    handlerClick (e) {
      this.$emit('click', e)
    }
  }
}

Vue.component('btButton', btButton)
